﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QLTV_Public;

namespace QLTV_Data
{
  public  class GiaoVien_Data
    {
      KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
      public DataTable TaoBang(string sql)
      {
          return kn.taobang(sql);
      }
      public DataTable LayDuLieu()
      {
          return kn.LayDuLieu("Load_GiaoVien");
      }
      public int Insert(GiaoVien_Public maDocGia, GiaoVien_Public anh, GiaoVien_Public hoVaTen, GiaoVien_Public gioiTinh, GiaoVien_Public ngaySinh, GiaoVien_Public maDanToc, GiaoVien_Public trinhDo, GiaoVien_Public maChucVu, GiaoVien_Public maDonVi,GiaoVien_Public maThamSo ,GiaoVien_Public soDienThoai, GiaoVien_Public Email)
      {
          int Npara = 12;
          string[] name = new string[Npara];
          object[]value=new object[Npara];
          name[0] = "@MaDocGia";
          value[0] = maDocGia.MaDocGia;
          name[1] = "@Anh";
          value[1] = anh.Anh;
          name[2] = "@HoVaTen";
          value[2] = hoVaTen.HoVaTen;
          name[3] = "@GioiTinh";
          value[3] = gioiTinh.GioiTinh;
          name[4] = "@NgaySinh";
          value[4] = ngaySinh.NgaySinh;
          name[5] = "@MaDanToc";
          value[5] = maDanToc.MaDanToc;
          name[6] = "@TrinhDo";
          value[6] = trinhDo.TrinhDo;
          name[7] = "@MaChucVu";
          value[7] = maChucVu.MaChucVu;
          name[8] = "@MaDonVi";
          value[8] = maDonVi.MaDonVi;
          name[9] = "@MaThamSo";
          value[9] = maThamSo.MaThamSo;
          name[10] = "@SoDienThoai";
          value[10] = soDienThoai.SoDienThoai;
          name[11] = "@Email";
          value[11] = Email.Email;

          return kn.update("Insert_GiaoVien",name,value,Npara);
      }
      public int Update(GiaoVien_Public maDocGia, GiaoVien_Public anh, GiaoVien_Public hoVaTen, GiaoVien_Public gioiTinh, GiaoVien_Public ngaySinh, GiaoVien_Public maDanToc, GiaoVien_Public trinhDo, GiaoVien_Public maChucVu, GiaoVien_Public maDonVi,GiaoVien_Public maThamSo, GiaoVien_Public soDienThoai, GiaoVien_Public Email)
      {
          int Npara = 12;
          string[] name = new string[Npara];
          object[] value = new object[Npara];
          name[0] = "@MaDocGia";
          value[0] = maDocGia.MaDocGia;
          name[1] = "@Anh";
          value[1] = anh.Anh;
          name[2] = "@HoVaTen";
          value[2] = hoVaTen.HoVaTen;
          name[3] = "@GioiTinh";
          value[3] = gioiTinh.GioiTinh;
          name[4] = "@NgaySinh";
          value[4] = ngaySinh.NgaySinh;
          name[5] = "@MaDanToc";
          value[5] = maDanToc.MaDanToc;
          name[6] = "@TrinhDo";
          value[6] = trinhDo.TrinhDo;
          name[7] = "@MaChucVu";
          value[7] = maChucVu.MaChucVu;
          name[8] = "@MaDonVi";
          value[8] = maDonVi.MaDonVi;
          name[9] = "@MaThamSo";
          value[9] = maThamSo.MaThamSo;
          name[10] = "@SoDienThoai";
          value[10] = soDienThoai.SoDienThoai;
          name[11] = "@Email";
          value[11] = Email.Email;

          return kn.update("Update_GiaoVien", name, value, Npara);
      }
      public int Delete(GiaoVien_Public maDocGia)
      {
          int Npara = 1;
          string[] name = new string[Npara];
          object[] value = new object[Npara];
          name[0] = "@MaDocGia";
          value[0] = maDocGia.MaDocGia;
 
          return kn.update("Delete_GiaoVien", name, value, Npara);
      }

      public DataTable Load_GiaoVien_Edit(string maDocGia)
      {
          int Nparamer = 1;
          string[] name = new string[Nparamer];
          object[] value = new object[Nparamer];
          name[0] = "@MaDocGia";
          value[0] = maDocGia;

          return kn.LayDuLieu("Load_GiaoVien_Edit",name,value,Nparamer);
      }
    }
}
